package com.kurumi.autoprint.util;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;



public class WebServiceUtil {

	/**
	 * 2：动态调用
	 * @throws Exception 
	 */
	public static Object getInpatientRecordsByIdNo(String webServiceUrl,String method,String param) throws Exception {
		// 创建动态客户端
		JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
		Client client = dcf.createClient(webServiceUrl);
		// 需要密码的情况需要加上用户名和密码
		// client.getOutInterceptors().add(new ClientLoginInterceptor(USER_NAME, PASS_WORD));
		Object[] objects = null;
		
			// invoke("方法名",参数1,参数2,参数3....);
		objects = client.invoke(method, param);
		if(objects!=null && objects.length>0) {
				
				
			return objects[0];
		}
		
		
		
		return null;
	}
}
